{extend name="$_admin_layout"}

{block name="tpl_vars"}
    {assign name="page_title" value="模块管理" /}
{/block}

{block name="main-content"}
    <form id="module_list" class="table-form table-manager">
        <div class="box box-red">
            <div class="box-header">
                <h3 class="box-title">模块列表</h3>
            </div>
            <div class="box-body">

                <div class="row">
                    <div class="col-sm-12">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>{:helper('admin/table')->render_header_text('名称')}</th>
                                    <th>{:helper('admin/table')->render_header_text('标题')}</th>
                                    <th>{:helper('admin/table')->render_header_text('描述')}</th>
                                    <th>{:helper('admin/table')->render_header_text('开发者')}</th>
                                    <th>{:helper('admin/table')->render_header_text('版本')}</th>
                                    <th>{:helper('admin/table')->render_header_text('排序')}</th>
                                    <th>{:helper('admin/table')->render_header_text('状态')}</th>
                                    <th>{:helper('admin/table')->render_header_text('操作')}</th>
                                </tr>
                            </thead>
                            <tbody>
                                {foreach name="module_list" item="vo"}
                                    <tr>
                                        <td>{:helper('admin/table')->render_column_text($vo['name'])}</td>
                                        <td>{:helper('admin/table')->render_column_text($vo['title'])}</td>
                                        <td>{:helper('admin/table')->render_column_text($vo['description'])}</td>
                                        <td>{:helper('admin/table')->render_column_text($vo['developer'])}</td>
                                        <td>{:helper('admin/table')->render_column_text($vo['version'])}</td>
                                        <td>{:helper('admin/table')->render_column_text($vo['sort'])}</td>
                                        <td>
                                            {switch name="vo.status"}
                                                {case value="1"}<span class="label label-success">有效</span>{/case}
                                                {case value="0"}<span class="label label-danger">无效</span>{/case}
                                                {case value="-1"}<span class="label label-default">未安装</span>{/case}
                                            {/switch}
                                        </td>
                                        <td>
                                            {notempty name="vo.id"}
                                                <?php if ($vo['is_system'] == 1): ?>
                                                    {:helper('admin/html')->render_span('系统模块不允许修改', 'label label-default')}
                                                <?php else: ?>
                                                    {:helper('admin/table')->render_action('修改', 'fa fa-edit', 'btn btn-primary btn-xs form-get', array('url' => $_controller->url('modify', array('id' => $vo['id']))))}
                                                    {:helper('admin/table')->render_action('卸载', 'fa fa-trash', 'btn btn-primary btn-danger btn-xs ajax-post', array('url' => $_controller->url('uninstall', array('id' => $vo['id'])), 'confirm-text' => '确定卸载选择的模块吗？'))}
                                                <?php endif; ?>
                                            {else /}
                                                {:helper('admin/table')->render_action('安装', 'fa fa-plus', 'btn btn-primary btn-xs ajax-post', array('url' => $_controller->url('install', array('name' => $vo['name'])), 'confirm-text' => '确定安装选择的模块吗？'))}
                                            {/notempty}
                                        </td>
                                    </tr>
                                {/foreach}
                            </tbody>
                        </table>
                    </div>
                </div>

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </form>
{/block}
